#pragma once

#include "BasicCodeHighlighter.hpp"
#include "ErrorModel.hpp"




namespace Engine
{
	namespace Edit
	{
		class AngelscriptHighlighter
			: public BasicCodeHighlighter
		{
		public:

			SHARED(AngelscriptHighlighter);

			enum Type
			{
				PrimitiveType, //< void, bool, int, double, etc...
				UserType, //< application registered types
				SpecialValue, //< null, true, false, etc...
				UserTypeKeywords, //< class, enum, this, etc...
				Operators, //< and, or, xor, cast, etc...
				FunctionCall, //< anything involving operator()
				Control, //< control keywords
			};

			AngelscriptHighlighter(QTextDocument* parent, ErrorModel::const_ptr errors);
			virtual ~AngelscriptHighlighter();

		protected:

			/**
			 * @returns the formatting rules for the given type of element
			 */
			QTextCharFormat format(Type type) const;

			/**
			 * Adds the given list of keywords to the highlighting rules.
			 *
			 * @param keywords   the keywords to add
			 * @param type       the type of keywords (determines formatting)
			 */
			void add(QStringList keywords, Type type);

		private:

			ErrorModel::const_ptr   m_errors;
		};
		///////////////////////////////////////////////////////////////////////////////////////////
	}
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
